home *** CD-ROM | disk | FTP | other *** search
/ The X-Philes (2nd Revision) / The X-Philes Number 1 (1995).iso / xphiles / hp48_1 / pubdom.tar / pubdom / e_vogel / vfterr < prev    next >
Text File  |  1990-05-19  |  2KB  |  36 lines

  1. %%HP: T(3)A(D)F(.);                        @ VFTERR: verify that two arguments
  2.                                            @ are both unit objects containing
  3.                                            @ only pure temperature units.
  4.                                            @ Error-trapping approach.
  5. \<<                                        @ obj2 obj1 ->
  6.   RCLF                                     @ Save flags
  7.                                            @ obj2 obj1 {flags} ->
  8.   -55 SF                                   @ Don't save args if error occurs
  9.   OVER                                     @ obj2 obj1 {flags} obj1 ->
  10.   4 PICK                                   @ obj2 obj1 {flags} obj1 obj2 ->
  11.   IFERR                                    @ Test if unit objects
  12.     CONVERT                                @ Try to convert obj1 to obj2 
  13.   THEN                                     @ Error: both not unit objects
  14.                                            @ obj2 obj1 {flags} ->
  15.     STOF                                   @ Restore flags
  16.                                            @ obj2 obj1 ->
  17.     ERRN DOERR                             @ Issue the same error
  18.   END                                      @ ->
  19.                                            @ No error: both unit objects
  20.                                            @ obj2 obj1 {flags} obj3 ->
  21.   IFERR                                    @ Test if pure temperatures
  22.     1_K CONVERT                            @ Try to convert obj3 to pure temp
  23.   THEN                                     @ Error means not pure temperatures
  24.                                            @ obj2 obj1 {flags} ->
  25.     STOF                                   @ Restore flags
  26.                                            @ obj2 obj1 ->
  27.     ERRN DOERR                             @ Issue the same error
  28.   ELSE                                     @ No error: pure temperatures
  29.                                            @ obj2 obj1 {flags} obj4 ->
  30.     DROP                                   @ Discard result
  31.                                            @ obj2 obj1 {flags} ->
  32.     STOF                                   @ Restore flags
  33.                                            @ obj2 obj1 ->
  34.   END    
  35. \>>
  36.